package soen343.domain;

import java.util.ArrayList;
import java.util.List;

public class MultipleChoiceQuestion extends Question {

	private List<String> _choices = null;
	 
	public MultipleChoiceQuestion(String name) {
		super(name);
		_choices = new ArrayList<String>();
	}

	public void addChoice(String choice) {
		_choices.add(choice);
	}
	
	public String toHTML() {
		String html = "<div class=\"questionText\">" + getText() + "</div>\n" +
			"<div class=\"questionInput\">\n";
		
		int count = 0;
		for(String choice : _choices) {
			html += "<input type=\"radio\" name=\"" + getName() + "\" id=\"" +
				getName() + count + "\" value=\""+ count+ "\" />\n" +
				"\t<label for=\"" + getName() + count + "\">" + choice + "</label><br />\n";
			count++;
		}
		html += "</div>\n";
		
		return html;
	}
}
